package Niuke;

import java.util.Scanner;

public class BILIBILI {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        if (num==2) {
            System.out.println(2);
            return;
        }
        int sum=0;
        int divide_num=2;
        for (;;){
            if (divide_num*divide_num>num)
                break;
            if (num%divide_num==0){
                num/=divide_num;
                sum+=divide_num;
            }else {
                divide_num++;
            }
        }
        int res=num+sum;
        System.out.println(res);
    }
}
